package com.ympc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 配置上传文件的访问路径
        registry.addResourceHandler("/uploads/**")
                .addResourceLocations("file:uploads/");
        
        // 配置静态资源路径
        registry.addResourceHandler("/img/**")
                .addResourceLocations("classpath:/static/img/");
        
        // 配置课程资源文件访问路径
        registry.addResourceHandler("/course_resources/**")
                .addResourceLocations("file:uploads/course_resources/");
        
        // 配置PPT文件访问路径
        registry.addResourceHandler("/ppt_files/**")
                .addResourceLocations("file:uploads/ppt/");
    }
}

